<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/common/common.jspf" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>test</title>

</head>



<script>

    $(document).ready(function(){

        $('#dg').datagrid({
            url:"${proPath}/refunds/show.action",
            checkbox: true,
            fitColumns:true,
            toolbar: [{
                iconCls: 'icon-edit',
                text:'查看与审核',
                handler: function(){
                    var selectrow= $('#dg').datagrid('getSelected');
                    if(selectrow==null){
                        //没选择情况下
                        alert("请选择你要审批的订单")
                    }else if (selectrow.statusAudits>5){
                        alert("订单审核完毕")
                    }
                    else {
                        parent.$('#win').window({
                            width:1000,
                            height:600,
                            modal:true,
                            content:"<iframe src='${proPath}/base/goURL.action?url=order/refunds_shenhe' title='结算页面' height='100%' width='100%' frameborder='0px'/>"
                        });
                    }
                }
            },'-',
            ],

            columns:[[

                {checkbox: true},
                {field:'deskId',title:'餐桌ID',width:100},
                {field:'deskName',title:'餐桌名称',width:100},
                {field:'refundsNum',title:'退单号',width:100},
                {field:'orderNum',title:'原订单号',width:100},
                {field:'refundsState',title:'退单状态',width:100,formatter:rowformater1},
                {field:'refundsPay',title:'退款金额',width:100},
                {field:'refundsTime',title:'退单时间',width:200,  formatter:function(value,row,index){
                    var date = new Date(value);//把返回的数据转化成date类型数据
                    return myformatter(date);//调用转化格式function
                } },
                {field:'refundsReason',title:'原因',width:100},
                {field:'statusAudits',title:'审核状态',width:100,formatter:rowformater},
                {field:'payForm',title:'付款形式',width:100,align:'right'}
            ]],
            striped:true,
            rownumbers:true,
            pagination:true,
            singleSelect:true,
            pageSize:5,
            pageList:[1,2,3,4,5]
        });


    })

    function rowformater1(value, row, index) {
        // alert(value);
        if (value==1){
            value="下单"
        }else if (value==2){
            value="接单"
        }else if (value==3){
            value="上菜"
        }else if (value==4){
            value="未结款"
        } else if (value==5){
            value="已经款"
        }
        else {
            value="未知情况"
        }
        //   alert(value);
        return value
        //return '<a href="login.jsp" onclick="delHsCode(' + index + ')">value</a>';
    }

    function rowformater(value, row, index) {
        if (value==6){
            value="通过"
        }else if (value==7){
            value="驳回"
        }else if(value==8){
            value="未审核"
        }else {
            value="未知情况"
        }
        //   alert(value);
        return value
        //return '<a href="login.jsp" onclick="delHsCode(' + index + ')">value</a>';
    }

    //搜索function
    function search() {
        var compayid = $("#cc").find("option:selected").text();//获取公司名字
        var storename = $("#bm").find("option:selected").text();//商店名称
        var payform=$("#payform").find("option:selected").text();//商店名称
        var deskid = $("#deskId").val();//获取桌号
        var deskname = $("#deskName").val();//获取餐桌名字
        var ordernum = $("#orderNum").val();//获取订单号
        var refundsnum=$("#refundsNum").val();//获取退单号
        var total = deskid + deskname + ordernum+refundsnum;
        alert(total);
        if (total == null || total == '') {
            alert("没有填写信息")
        } else {
            $('#dg').datagrid('load', {
                //注入搜索信息更新datagrid
                deskId: deskid,
                deskName: deskname,
                orderNum: ordernum,
                refundsNum:refundsnum,
            });

        }
    }

</script>
</head>
<body>
<form >
    公司名字：<select id="cc" class="easyui-combobox" name="dept" style="width:200px;">
    <option value="aa">广宁集团</option>
    <option>浩明制药</option>
    <option>伟竹保健</option>
</select>

    部门名字：<select id="bm" class="easyui-combobox" name="dept" style="width:200px;">
    <option value="aa">广宁广州分公司</option>
    <option>浩明广州制药厂</option>
    <option>伟竹保健广州分部</option>
</select>

    餐桌号:<input id="deskId" type="text" value=""><br>
    餐桌名字:<input id="deskName" type="text" value="">
    原订单号:<input id="orderNum" type="text" value="">
    退单号:<input id="refundsNum" type="text" value=""><br>

    退款状态：<select id="refundsstate" class="easyui-combobox" name="dept" style="width:200px;">
    <option value="aa">审核中</option>
    <option>已退款</option>
    <option>驳回</option>
</select>


    付款方式：<select id="pay-form" class="easyui-combobox" name="dept" style="width:200px;">
    <option value="aa">移动</option>
    <option>现金</option>
</select><br>

    审核状态：<select id="shenhe" class="easyui-combobox" name="dept" style="width:200px;">
    <option value="aa">未审核</option>
    <option>审核通过</option>
    <option>返回</option></br>

</select>

    <input type="button" onclick="search()">搜索
</form>



<table id="dg"
       data-options="singleSelect:false,checkOnSelect:false,fitColumns:true"
></table>

<table id="detail"></table>

<div id="win"></div>
</body>
</html>
